// $Id: list.h 2 2011-10-17 17:49:43Z cedric.shih@gmail.com $
/*
 * Copyright 2011 Cedric Shih (cedric dot shih at gmail dot com)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef LIST_H_
#define LIST_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <sys/queue.h>

struct zcbuffer;

struct zcbuffer_item {
	struct zcbuffer *buffer;
	TAILQ_ENTRY(zcbuffer_item) entry;
};

TAILQ_HEAD(zcbuffer_list, zcbuffer_item);

int zcbuffer_list_add(struct zcbuffer_list *list, struct zcbuffer *buffer);

int zcbuffer_list_remove(struct zcbuffer_list *list, struct zcbuffer *buffer);

int zcbuffer_list_clear(struct zcbuffer_list *list);

int zcbuffer_list_add_cache(struct zcbuffer_list *list,
		struct zcbuffer **buffer);

int zcbuffer_list_remove_cache(struct zcbuffer_list *list,
		struct zcbuffer *buffer);

int zcbuffer_list_clear_caches(struct zcbuffer_list *list);

#ifdef __cplusplus
}
#endif

#endif /* LIST_H_ */
